import unittest
from test_case import Demo1, Demo2

# 方式一: 创建一个加载器对象
# loader = unittest.TestLoader()
loader1 = unittest.defaultTestLoader.loadTestsFromTestCase(Demo1.DemoTestCase)  # 参数:测试类
loader2 = unittest.defaultTestLoader.loadTestsFromTestCase(Demo2.Demo2TestCase)

# 创建一个测试套件
suite = unittest.TestSuite()
# suite.addTest(loader1)
# suite.addTest(loader2)
suite.addTests([loader1, loader2])

# 创建执行器,执行测试类
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
